package com.tmobile.phonebook;

public class Subscriber {
	
	private long phoneNumber; // 10 digit positive number
	private String name;
	private float balanceInCents; 
	private float decrementRate; //rate
	
	public Subscriber() 
	{
		
		this.phoneNumber = 0xFFFFFFFF;
		this.name = "";
		this.balanceInCents = 0.0f;
		this.decrementRate = 0.0f;
	}

	public Subscriber(long phoneNumber, String name, float balanceInCents,float decrementRate) 
	{
		this.phoneNumber = phoneNumber;
		this.name = name;
		this.balanceInCents = balanceInCents;
		this.decrementRate = decrementRate;
	}
	
	//copy constructor
	public Subscriber (Subscriber s)
	{
		if (null == s)
			throw new IllegalArgumentException("Null Subscriber not supported. Use the default constructor");
		
		// all are immutable - (primitives/Strings) - hence not creating defensive copies
		this.phoneNumber = s.phoneNumber;
		this.name = s.name;
		this.balanceInCents = s.balanceInCents;
		this.decrementRate = s.decrementRate;
	}
	
	public long getPhoneNumber() {
		return phoneNumber;
	}

	public void setPhoneNumber(long phoneNumber) {
		this.phoneNumber = phoneNumber;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public float getBalanceInCents() {
		return balanceInCents;
	}

	public void setBalanceInCents(float balanceInCents) {
		this.balanceInCents = balanceInCents;
	}

	public float getDecrementRate() {
		return decrementRate;
	}

	public void setDecrementRate(float decrementRate) {
		this.decrementRate = decrementRate;
	}
	
	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("Subscriber [phoneNumber=");
		builder.append(phoneNumber);
		builder.append(", name=");
		builder.append(name);
		builder.append(", balanceInCents=");
		builder.append(balanceInCents);
		builder.append(", decrementRate=");
		builder.append(decrementRate);
		builder.append("]");
		return builder.toString();
	}
	
	
	
}
